package com.imooc.distributelock.controller;

import com.imooc.distributelock.service.StockService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.locks.ReentrantLock;

@RestController
@Slf4j
public class StockController {

    @Autowired
    private StockService stockService;

    @GetMapping("/stock/deductStock/{goodsId}/{count}")
    public String deductStock(@PathVariable Long goodsId,@PathVariable Integer count){
        return stockService.deductStock(goodsId,count);
    }
}

